package com.example.testapplication.ui.home.home_list_fragment;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.base.MultiItemViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;
import me.goldze.mvvmhabit.utils.ToastUtils;

public class MutiItemTypeBViewModel extends MultiItemViewModel<HomeListFragViewModel> {
    public ObservableField<String> text = new ObservableField<>("");
    public MutiItemTypeBViewModel(@NonNull HomeListFragViewModel viewModel, String text) {
        super(viewModel);
        this.text.set(text);
    }
    //条目的点击事件
    public BindingCommand itemClick = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            //拿到position
            int position = viewModel.observableList.indexOf(MutiItemTypeBViewModel.this);
            ToastUtils.showShort("position：" + position);
        }
    });
}
